package com.culturalyard.mapper;

import com.culturalyard.pojo.dto.CameraPageQueryDTO;
import com.culturalyard.pojo.entity.Camera;
import com.culturalyard.pojo.vo.CameraVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CameraMapper {
    /**
     * 根据id查询监控,并装填其所属小院名字
     * @param id
     * @return
     */
    public CameraVO selectByIdWithYardName(String id);

    /**
     * 分页查询监控
     * @param cameraPageQueryDTO
     * @return
     */
    public Page<CameraVO> pageQuery(CameraPageQueryDTO cameraPageQueryDTO);

    /**
     * 查询一个文化小院下所有监控(置顶摄像头为第一个)
     * @param yardId
     * @return
     */
    @Select("select * from camera where yardId = #{yardId} order by cameraTopState desc")
    public List<Camera> selectByYardId(String yardId);

    /**
     * 设置监控信息
     * @param camera
     */
    void update(Camera camera);

    /**
     * 根据id查询设备
     * @param id
     */
    @Select("select * from camera where id = #{id}")
    Camera selectById(String id);

    /**
     * 查看常时监控区的所有设备（置顶的优先）
     * @param cameraManagementAreaState
     */
    public List<CameraVO> selectManagementArea(Integer cameraManagementAreaState);

    /**
     * 分页查询在常时监控区的所有设备（置顶优先）
     * @param exist
     * @return
     */
    Page<CameraVO> pageManagementArea(Integer exist);
}
